﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <div id="js-console"></div>
    <script src="../scripts/js-console.js"></script>
    <script>
        var array = [3, 5, 6, 7, 4, 2, 6, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 6, 4, 9, 10, 11, 12, 14, 20, 21];
        var arrayLength = array.length;

        var count = 1;
        var maxCount = 1;
        var maxEnd = 0;
        var end = 0;

        for (var i = 0; i < arrayLength - 1; i++) {
            if (array[i] < array[i + 1]) {
                count++;
                end = i + 1;
            }

            if (count > maxCount) {
                maxCount = count;
                maxEnd = end;
            }

            if (array[i] >= array[i + 1]) {
                end = i;
                count = 1;
            }
        }

        for (var i = maxEnd - maxCount + 1; i <= maxEnd; i++) {
            if (i != maxEnd) {
                jsConsole.write(array[i] + ",");
            }
            else {
                jsConsole.write(array[i]);
            }
        }
    </script>
</body>
</html>
